package com.wc.算法提高课.B第二章_搜索.迭代加深.加成序列;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/9/29 22:09
 * @description https://www.acwing.com/problem/content/172/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 110;
    static int[] path = new int[N];
    static int n;

    public static void main(String[] args) {
        while ((n = sc.nextInt()) > 0) {
            int depth = 0;
            path[0] = 1;
            while (!dfs(1, depth)) depth++;
            for (int i = 0; i < depth; i++) out.print(path[i] + " ");
            out.println();
        }
        out.flush();
    }

    static boolean dfs(int u, int maxDepth) {
        if (u > maxDepth) return false;
        if (path[u - 1] == n) return true;
        boolean[] st = new boolean[N];
        for (int i = u - 1; i >= 0; i--) {
            for (int j = i; j >= 0; j--) {
                int s = path[i] + path[j];
                if (s > n || s < path[u - 1] || st[s]) continue;
                st[s] = true;
                path[u] = s;
                if (dfs(u + 1, maxDepth)) {
                    return true;
                }
            }
        }
        return false;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
